﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
using System.ComponentModel; 
namespace Genespy
{
    [DataContract]
    public class Note:INotifyPropertyChanged
    {
        private string _note;
        private DateTime _date;

        [DataMember]
        public string note {
            get { return _note; }
            set
            {
                if (_note != value)
                {
                    _note = value;
                    OnPropertyChanged("note");
                }
            }
        }

        [DataMember]
        public DateTime date
        {
            get { return _date; }
            set
            {
                if (_date != value)
                {
                    _date = value;
                    OnPropertyChanged("date");
                }
            }
        }

        public Note(String newNote) {
            note = newNote;
            date = DateTime.UtcNow; 
        }
        public event PropertyChangedEventHandler PropertyChanged;

        public void OnPropertyChanged(String propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public Note()
        { }
    }
}
